<div class="lightbox">

    <h1>Rediger vakt</h1>

    <h2>Vis</h2>

    <?php $formUrl = $this->url(array('module' => 'admin', 'controller' => 'shift', 'action' => 'memberroletable'), null, true); ?>
    
    <form enctype="application/x-www-form-urlencoded" method="post" accept-charset="UTF-8" action="<?php echo $formUrl; ?>" id="update_member_table">
        <input type="checkbox" name="ignore_courses" id="ignore_courses"<?php echo $this->ignore_courses ? ' checked="true"' : ''; ?>>
        <label for="ignore_courses">Ukvalifiserte</label>

        <input type="checkbox" name="ignore_passive" id="ignore_passive"<?php echo $this->ignore_passive ? 'checked="true"' : ''; ?>>
        <label for="ignore_passive">Passive</label>

        <input type="checkbox" name="ignore_permanent_passive" id="ignore_permanent_passive"<?php echo $this->ignore_permanent_passive ? 'checked="true"' : ''; ?>>
        <label for="ignore_permanent_passive">Permanent passive</label>

        <input type="hidden" name="role" value="<?php echo $this->shift_role_id; ?>"/>
        <input type="submit" name="submit" value="Oppdater tabell" />
    </form>
    
    <h2>Oversikt</h2>

    <form enctype="application/x-www-form-urlencoded" method="post" accept-charset="UTF-8" action="<?php echo $formUrl; ?>" id="memberRoleForm">
        <table id="datatable" class="members_for_shift display">
            <thead>
                <tr id="member_role_tr">
                    <th id="first_name" class="memberrolehead">Fornavn</th>
                    <th id="last_name" class="memberrolehead">Etternavn</th>
                    <th id="interest" class="memberrolehead">Interesse</th>
                    <th id="weight" class="memberrolehead">Vaktpoeng</th>
                    <th class="memberrolehead">Velg</th>
                </tr>
            </thead>
            <tbody>
                <?php foreach ($this->members as $member) : ?>
                <tr<?php
                    if($member['course_count'] < $member['required_course_count']) {
                        echo ' class="not_qualified"';
                    } elseif ($member['is_permanent_passive'] > 0) {
                        echo ' class="is_permanent_passive"';
                    } elseif ($member['is_passive'] > 0) {
                        echo ' class="is_passive"';
                    } elseif ($member['interest'] > 0) {
                        echo ' class="interest"';
                    } ?>>
                    <td><?php echo $this->escape($member['first_name']); ?></td>
                    <td><?php echo $this->escape($member['last_name']); ?></td>
                    <td><strong><?php echo $member['interest'] == '1' ? 'Ja' : 'Nei'; ?></strong></td>
                    <td><?php echo $this->escape($member['weight']); ?></td>
                    <td><input type="radio" name="member_id" value="<?php echo $member['id']; ?>"></td>
                </tr>
                <?php endforeach; ?>
            </tbody>
        </table>
        <input type="hidden" name="role" value="<?php echo $this->shift_role_id; ?>"/>
        <input type="submit" name="submit" id="submit_member_role" value="Legg til medlem for rolle" />
    </form>

    <p>&nbsp;</p>

    <table class="colorcodes clean">
        <tbody>
            <tr>
                <td id="first"><img src="<?php echo $this->imageLink('images/icons/color_red.png'); ?>" /> Ukvalifisert</td>
                <td><img src="<?php echo $this->imageLink('/images/icons/color_green.png'); ?>" /> Interessert i arrangementet</td>
                <td><img src="<?php echo $this->imageLink('/images/icons/color_blue.png'); ?>" /> Er passiv</td>
                <td><img src="<?php echo $this->imageLink('/images/icons/color_yellow.png'); ?>" /> Er permanent passiv</td>
            </tr>
        </tbody>
    </table>
</div>
